//
// Created by win10 on 2024/12/30.
//
#include <stdio.h>

// 二分查找函数，同时返回比较次数
int binarySearch(int arr[], int n, int target, int *compareCount) {
    int left = 0;
    int right = n - 1;
    *compareCount = 0;
    while (left <= right) {
        (*compareCount)++;
        int mid = (left + right) / 2;
        if (arr[mid] == target) {
            return mid;
        } else if (arr[mid] < target) {
            left = mid + 1;
        } else {
            right = mid - 1;
        }
    }
    return -1;
}

int main() {
    int n;
    scanf("%d", &n);
    int arr[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }
    int x;
    scanf("%d", &x);

    int compareCount;
    int result = binarySearch(arr, n, x, &compareCount);
    printf("%d\n", result);
    printf("%d\n", compareCount);

    return 0;
}